#include <cstdio>

using namespace std;

class Point
{
	public:
		double  x;
		double  y;

		Point(double _x=0, double _y=0)
		{
			x = _x;
			y = _y;
		}

		Point(const Point& _point)
		{
			x = _point.x;
			y = _point.y;
		}

		~Point() {}
};

class Rectangle: public Point
{
	public:
		double  width;
		double  height;

		Rectangle(Point _point, double _width, double _height): Point(_point)
		{
			width = _width;
			height = _height;
		}

		Rectangle(const Rectangle& _rectangle): Point(_rectangle)
		{
			width = _rectangle.width;
			height = _rectangle.height;
		}

		~Rectangle() {}

		double getS()
		{
			return width * height;
		}
};

class Cube: public Rectangle
{
	public:
		double  length;

		Cube(Rectangle _rectangle, double _length): Rectangle(_rectangle)
		{
			length = _length;
		}

		Cube(const Cube& _cube): Rectangle(_cube)
		{
			length = _cube.length;
		}

		~Cube() {}

		double getV()
		{
			return getS() * length;
		}
};

int main()
{
	Point point(0, 0);

	Rectangle rectangle(point, 4, 2);
	printf("S = %lf\n", rectangle.getS());

	Cube cube(rectangle, 3);
	printf("V = %lf\n", cube.getV());

	printf("\n");

	Point point2(1, 1);

	Rectangle rectangle2(point2, 4, 5);
	printf("S = %lf\n", rectangle2.getS());

	Cube cube2(rectangle2, 10);
	printf("V = %lf\n", cube2.getV());

	return 0;
}
